/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package edu.pku.sei.ocl.adapter.xmlecore.impl;

import edu.pku.sei.ocl.adapter.AdapterPackage;

import edu.pku.sei.ocl.adapter.xmlecore.EXMLAttribute;
import edu.pku.sei.ocl.adapter.xmlecore.EXMLCDATASection;
import edu.pku.sei.ocl.adapter.xmlecore.EXMLCharacterData;
import edu.pku.sei.ocl.adapter.xmlecore.EXMLComment;
import edu.pku.sei.ocl.adapter.xmlecore.EXMLDocument;
import edu.pku.sei.ocl.adapter.xmlecore.EXMLElement;
import edu.pku.sei.ocl.adapter.xmlecore.EXMLNode;
import edu.pku.sei.ocl.adapter.xmlecore.XmlecoreFactory;
import edu.pku.sei.ocl.adapter.xmlecore.XmlecorePackage;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class XmlecorePackageImpl extends EPackageImpl implements XmlecorePackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass exmlDocumentEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass exmlNodeEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass exmlElementEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass exmlAttributeEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass exmlcdataSectionEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass exmlCommentEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass exmlCharacterDataEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see edu.pku.sei.ocl.adapter.xmlecore.XmlecorePackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private XmlecorePackageImpl() {
		super(eNS_URI, XmlecoreFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link XmlecorePackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static XmlecorePackage init() {
		if (isInited) return (XmlecorePackage)EPackage.Registry.INSTANCE.getEPackage(XmlecorePackage.eNS_URI);

		// Obtain or create and register package
		XmlecorePackageImpl theXmlecorePackage = (XmlecorePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof XmlecorePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new XmlecorePackageImpl());

		isInited = true;

		// Initialize simple dependencies
		AdapterPackage.eINSTANCE.eClass();

		// Create package meta-data objects
		theXmlecorePackage.createPackageContents();

		// Initialize created meta-data
		theXmlecorePackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theXmlecorePackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(XmlecorePackage.eNS_URI, theXmlecorePackage);
		return theXmlecorePackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getEXMLDocument() {
		return exmlDocumentEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getEXMLDocument_Encoding() {
		return (EAttribute)exmlDocumentEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getEXMLDocument_XmlVersion() {
		return (EAttribute)exmlDocumentEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getEXMLDocument_DocumentElement() {
		return (EReference)exmlDocumentEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getEXMLNode() {
		return exmlNodeEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getEXMLNode_Children() {
		return (EReference)exmlNodeEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getEXMLNode_Parent() {
		return (EReference)exmlNodeEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getEXMLNode_Document() {
		return (EReference)exmlNodeEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getEXMLElement() {
		return exmlElementEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getEXMLElement_TagName() {
		return (EAttribute)exmlElementEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getEXMLElement_Attributes() {
		return (EReference)exmlElementEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getEXMLAttribute() {
		return exmlAttributeEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getEXMLAttribute_Name() {
		return (EAttribute)exmlAttributeEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getEXMLAttribute_Value() {
		return (EAttribute)exmlAttributeEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getEXMLAttribute_IsID() {
		return (EAttribute)exmlAttributeEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getEXMLAttribute_OwnerElement() {
		return (EReference)exmlAttributeEClass.getEStructuralFeatures().get(3);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getEXMLCDATASection() {
		return exmlcdataSectionEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getEXMLComment() {
		return exmlCommentEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getEXMLCharacterData() {
		return exmlCharacterDataEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getEXMLCharacterData_Data() {
		return (EAttribute)exmlCharacterDataEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public XmlecoreFactory getXmlecoreFactory() {
		return (XmlecoreFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		exmlDocumentEClass = createEClass(EXML_DOCUMENT);
		createEAttribute(exmlDocumentEClass, EXML_DOCUMENT__ENCODING);
		createEAttribute(exmlDocumentEClass, EXML_DOCUMENT__XML_VERSION);
		createEReference(exmlDocumentEClass, EXML_DOCUMENT__DOCUMENT_ELEMENT);

		exmlNodeEClass = createEClass(EXML_NODE);
		createEReference(exmlNodeEClass, EXML_NODE__CHILDREN);
		createEReference(exmlNodeEClass, EXML_NODE__PARENT);
		createEReference(exmlNodeEClass, EXML_NODE__DOCUMENT);

		exmlElementEClass = createEClass(EXML_ELEMENT);
		createEAttribute(exmlElementEClass, EXML_ELEMENT__TAG_NAME);
		createEReference(exmlElementEClass, EXML_ELEMENT__ATTRIBUTES);

		exmlAttributeEClass = createEClass(EXML_ATTRIBUTE);
		createEAttribute(exmlAttributeEClass, EXML_ATTRIBUTE__NAME);
		createEAttribute(exmlAttributeEClass, EXML_ATTRIBUTE__VALUE);
		createEAttribute(exmlAttributeEClass, EXML_ATTRIBUTE__IS_ID);
		createEReference(exmlAttributeEClass, EXML_ATTRIBUTE__OWNER_ELEMENT);

		exmlcdataSectionEClass = createEClass(EXMLCDATA_SECTION);

		exmlCommentEClass = createEClass(EXML_COMMENT);

		exmlCharacterDataEClass = createEClass(EXML_CHARACTER_DATA);
		createEAttribute(exmlCharacterDataEClass, EXML_CHARACTER_DATA__DATA);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		AdapterPackage theAdapterPackage = (AdapterPackage)EPackage.Registry.INSTANCE.getEPackage(AdapterPackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		exmlDocumentEClass.getESuperTypes().add(this.getEXMLNode());
		exmlNodeEClass.getESuperTypes().add(theAdapterPackage.getEcoreAdapter());
		exmlElementEClass.getESuperTypes().add(this.getEXMLNode());
		exmlAttributeEClass.getESuperTypes().add(this.getEXMLNode());
		exmlcdataSectionEClass.getESuperTypes().add(this.getEXMLNode());
		exmlcdataSectionEClass.getESuperTypes().add(this.getEXMLCharacterData());
		exmlCommentEClass.getESuperTypes().add(this.getEXMLCharacterData());
		exmlCommentEClass.getESuperTypes().add(this.getEXMLNode());
		exmlCharacterDataEClass.getESuperTypes().add(this.getEXMLNode());

		// Initialize classes and features; add operations and parameters
		initEClass(exmlDocumentEClass, EXMLDocument.class, "EXMLDocument", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getEXMLDocument_Encoding(), ecorePackage.getEString(), "encoding", null, 0, 1, EXMLDocument.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getEXMLDocument_XmlVersion(), ecorePackage.getEString(), "xmlVersion", null, 0, 1, EXMLDocument.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getEXMLDocument_DocumentElement(), this.getEXMLElement(), null, "documentElement", null, 0, 1, EXMLDocument.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(exmlNodeEClass, EXMLNode.class, "EXMLNode", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getEXMLNode_Children(), this.getEXMLNode(), this.getEXMLNode_Parent(), "children", null, 0, -1, EXMLNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getEXMLNode_Parent(), this.getEXMLNode(), this.getEXMLNode_Children(), "parent", null, 0, 1, EXMLNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getEXMLNode_Document(), this.getEXMLDocument(), null, "document", null, 0, 1, EXMLNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		addEOperation(exmlNodeEClass, ecorePackage.getEString(), "getNodeName", 0, 1, IS_UNIQUE, IS_ORDERED);

		initEClass(exmlElementEClass, EXMLElement.class, "EXMLElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getEXMLElement_TagName(), ecorePackage.getEString(), "tagName", null, 0, 1, EXMLElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getEXMLElement_Attributes(), this.getEXMLAttribute(), this.getEXMLAttribute_OwnerElement(), "attributes", null, 0, -1, EXMLElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		EOperation op = addEOperation(exmlElementEClass, ecorePackage.getEString(), "getAttribute", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED);

		op = addEOperation(exmlElementEClass, ecorePackage.getEString(), "getAttributeNS", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "namespaceURI", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "localName", 0, 1, IS_UNIQUE, IS_ORDERED);

		op = addEOperation(exmlElementEClass, null, "setAttribute", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "value", 0, 1, IS_UNIQUE, IS_ORDERED);

		op = addEOperation(exmlElementEClass, null, "setAttributeNS", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "namespaceURI", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "localName", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "value", 0, 1, IS_UNIQUE, IS_ORDERED);

		op = addEOperation(exmlElementEClass, this.getEXMLAttribute(), "getAttributeNode", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "name", 0, 1, IS_UNIQUE, IS_ORDERED);

		op = addEOperation(exmlElementEClass, this.getEXMLAttribute(), "getAttributeNodeNS", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "namespaceURI", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEString(), "localName", 0, 1, IS_UNIQUE, IS_ORDERED);

		initEClass(exmlAttributeEClass, EXMLAttribute.class, "EXMLAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getEXMLAttribute_Name(), ecorePackage.getEString(), "name", null, 0, 1, EXMLAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getEXMLAttribute_Value(), ecorePackage.getEString(), "value", null, 0, 1, EXMLAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getEXMLAttribute_IsID(), ecorePackage.getEBoolean(), "isID", null, 0, 1, EXMLAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getEXMLAttribute_OwnerElement(), this.getEXMLElement(), this.getEXMLElement_Attributes(), "ownerElement", null, 0, 1, EXMLAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(exmlcdataSectionEClass, EXMLCDATASection.class, "EXMLCDATASection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(exmlCommentEClass, EXMLComment.class, "EXMLComment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(exmlCharacterDataEClass, EXMLCharacterData.class, "EXMLCharacterData", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getEXMLCharacterData_Data(), ecorePackage.getEString(), "data", null, 0, 1, EXMLCharacterData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		// Create resource
		createResource(eNS_URI);
	}

} //XmlecorePackageImpl
